<%@ page contentType="text/html; charset=utf-8" language="java"
	import="java.sql.*" import="shared.MyDateUtil" errorPage=""%>
<%@ page import="com.google.appengine.api.users.User"%>
<%@ page import="com.google.appengine.api.users.UserService"%>
<%@ page import="com.google.appengine.api.users.UserServiceFactory"%>
<%@ page import="javax.jdo.PersistenceManager"%>
<%@ page import="javax.jdo.Query"%>
<%@ page import="java.util.*"%>
<%@ page import="shared.*"%>
<%@ page import="pk1.*"%>
<%@ page import="java.util.Date"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文件</title>
</head>

<body>
	<%
		UserService userService = UserServiceFactory.getUserService();
		User user = userService.getCurrentUser();
		String userName = "";
		if (user != null) {
			userName = user.getNickname();
	%>
	<p>
		您目前是以 <u><%=userName%></u>登入<br> 如果這不是您的帳號
	</p>
	<p>
		您可以<u><a
			href="<%=userService.createLogoutURL(request.getRequestURI())%>">登出</a></u>，再重新登入！
	</p>
	<p>
		<u><a href="/mem/editMem01.jsp"><span class="tabletx">修改會員資料</span></a></u>
	</p>
	<%
		
		PersistenceManager pm = PMF.get().getPersistenceManager();
		Query query = pm.newQuery(Record.class);
		try {
				List<Record> results = (List<Record>) query.execute();
			
	%>
<form method="get" action="/ConfirmServlet" >
<div id="content">
<div class="content_item">
	<table border="1" align="center">
		<tr><td>交易記錄</td></tr>
		<tr>
			<td>受邀者</td>
			<td>邀請者</td>
			<td>活動名稱</td>
			<td>受邀者交換條件</td>
			<td>邀請者交換條件</td>
			<td>日期</td>
			<td>留言</td>
			<td>交易狀態</td>
		</tr>
		<%
		
			for (Record rec : results) {
				if (rec.checkRecord(userName)){
		%>
		<tr>
			<td><input type = "hidden" name = "inviterd_ID" value="<%=rec.getInviterdID()%>"/><%=rec.getInviterdID()%></td>
			<td><input type = "hidden" name = "inviter_ID" value="<%=rec.getInviterID()%>" /><%=rec.getInviterID()%></td>
			<td><input type = "hidden" name = "invite_activity" value="<%=rec.getInviteActivity()%>" /><%=rec.getInviteActivity()%></td>
			<td><input type = "hidden" name = "inviterd_con" value="<%=rec.getInviterdCon()%>" /><%=rec.getInviterdCon()%></td>
			<td><input type = "hidden" name = "inviter_con" value="<%=rec.getInviterCon()%>" /><%=rec.getInviterCon()%></td>
			<td><input type = "hidden" name = "invite_date" value="<%=rec.getInviteDate()%>" /><%=rec.getInviteDate()%></td>
			<td><input type = "hidden" name ="invite_message" value="<%=rec.getInviteMessage()%>" /><%=rec.getInviteMessage()%></td>
			<td><input type = "hidden" name ="status" value="<%=rec.getStatus()%>" />
			<%
				if(String.valueOf(rec.getStatus()).equals("UnConfirm"))
				{
					
					%>
			<label>
                <input type="submit" name="check1"  value="成功" />
                <input type="submit" name="check2"  value="失敗" />
              </label>
             <% 
				}else{
					out.print(rec.getStatus());
					
				}
             %> 
			</td>
		</tr>
		<%
			}//if
				}// for
					
				} finally {
					query.closeAll();
					pm.close();
				}
			} else {
		%>
		<p>
			請 <a
				href="<%=userService.createLoginURL(request.getRequestURI())%>">登入</a>,
			以便開始點數交換
		</p>
		<%
			}
		%>


	</table>
</div></div>
</form>
</body>
</html>